package com.doge.walknovel.business.home.genres.rank

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.doge.walknovel.api.model.StrategyChildInfo

class RankTabViewModel constructor(private val repository: RankTabRepository) : ViewModel() {
    val tabs: LiveData<List<StrategyChildInfo>> = repository.tabs

    fun initializeTabs() {
        repository.initializeTabs()
    }
}


class RankTabViewModelFactory : ViewModelProvider.Factory {
    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
        val repository = RankTabRepository()
        if (modelClass.isAssignableFrom(RankTabViewModel::class.java)) {
            return RankTabViewModel(repository) as T
        }
        //noinspection unchecked
        throw IllegalArgumentException("Unknown ViewModel class")
    }
}